import Hikvision_CameraCall
import laser_contr
import time

# 对接：Square
# 搭接：Lap
# 单斜坡：singleBevel
# 单V：V


def capSingle():
    type = "V"
    thickness_angle = "6_up_2mm_15_"
    type_thickness = type + thickness_angle
    # 调用相机 + 控制激光开关
    laser_contr.Four_CC(0, 0, 0, 0)
    for i in range(20):  # 采集图像数量
        # 图像开始序号
        i = i + 0
        typeIdx = type_thickness + str(i)

        # 打开辅助灯光：提示 1.拍摄区域 2.移动工件
        laser_contr.Four_CC(1, 1, 1, 0)
        time.sleep(4)

        # 关闭辅助灯光：等待1S后拍摄
        laser_contr.Four_CC(1, 1, 0, 0)
        time.sleep(1)
        Hikvision_CameraCall.imgCapture(typeIdx)
        print("------ 图像%d采集完毕 -------" % i)

    # 采集完毕
    laser_contr.Four_CC(1, 1, 1, 1)
    laser_contr.Four_CC(0, 0, 0, 0)
    print("\n********** ALL DONE！**********")
    # 再显示区域
    laser_contr.Four_CC(1, 1, 1, 0)


def capMultiple():
    type = "S"
    thickness_angle = "6_g"
    type_thickness = type + thickness_angle
    # 调用相机 + 控制激光开关
    laser_contr.Four_CC(0, 0, 0, 0)
    for i in range(0, 72):
        # 图像开始序号
        i = i + 26
        typeIdx = type_thickness + str(i + 1)
        print("********** Group %d START！**********" % (i + 1))
        laser_contr.Four_CC(0, 0, 0, 0)
        Hikvision_CameraCall.imgCapture(typeIdx + "_1")
        # 三线
        laser_contr.Four_CC(1, 1, 0, 0)
        Hikvision_CameraCall.imgCapture(typeIdx + "_2")
        # 交叉
        laser_contr.Four_CC(0, 0, 1, 1)
        Hikvision_CameraCall.imgCapture(typeIdx + "_3")
        # 混合
        laser_contr.Four_CC(1, 1, 1, 1)
        Hikvision_CameraCall.imgCapture(typeIdx + "_4")
        # print(" END！")
        input("Enter To Continue ......")
    print("********** ALL DONE！**********")
    laser_contr.Four_CC(0, 0, 0, 0)
    laser_contr.Four_CC(1, 1, 1, 1)


capMultiple()
